]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
boxpointer: Unset the sourceActor on destruction
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 13 Jun 2019 16:57:38 +0000 (18:57 +0200)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 17 Jun 2019 10:39:26 +0000 (12:39 +0200)
A boxpointer sourceActor could be destroyed before the boxpointer itself.
In such case, unset the sourceActor reference, connecting to 'destroy' signal.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1295
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/576

js/ui/boxpointer.js

index 188e8386fb2f459c5ac36be20c005b3717c68355..5615614e1e30290c6c0764dc8dc552d159746c07 100644 (file)
@@ -48,6 +48,15 @@ var BoxPointer = GObject.registerClass({
         this._sourceAlignment = 0.5;
         this._capturedEventId = 0;
         this._muteInput();
+
+        this.connect('destroy', this._onDestroy.bind(this));
+    }
+
+    _onDestroy() {
+        if (this._sourceActorDestroyId) {
+            this._sourceActor.disconnect(this._sourceActorDestroyId);
+            delete this._sourceActorDestroyId;
+        }
     }
 
     get arrowSide() {
@@ -452,9 +461,26 @@ var BoxPointer = GObject.registerClass({
         // so that we can query the correct size.
         this.show();
 
-        this._sourceActor = sourceActor;
+        if (!this._sourceActor || sourceActor != this._sourceActor) {
+            if (this._sourceActorDestroyId) {
+                this._sourceActor.disconnect(this._sourceActorDestroyId);
+                delete this._sourceActorDestroyId;
+            }
+
+            this._sourceActor = sourceActor;
+
+            if (this._sourceActor) {
+                this._sourceActorDestroyId = this._sourceActor.connect('destroy', () => {
+                    this._sourceActor = null;
+                    delete this._sourceActorDestroyId;
+                })
+            }
+        }
         this._arrowAlignment = alignment;
 
+        if (!this._sourceActor)
+            return;
+
         this._reposition();
         this._updateFlip();
     }